/*
 * Author: junz
 */

import {defHttp} from '/@/utils/http/axios';
import {TagClassification, TagClassificationListGetResultModel} from '/@/model/resource/tagClassificationModel';
import {ErrorMessageMode} from "/#/axios";

enum Api {
    GET_TAG_CLASSIFICATION_ENTITY_PAGE_LIST = '/continuingEducationCourse/tagClassification/tree',
    GET_TAG_CLASSIFICATION_ENTITY_LIST = '/continuingEducationCourse/tagClassification/getTagClassificationList',
    GET_TAG_CLASSIFICATION_ENTITY_BY_ID = '/continuingEducationCourse/tagClassification/',
    TAG_CLASSIFICATION_ENTITY_UPDATE = '/continuingEducationCourse/tagClassification/updateById',
    TAG_CLASSIFICATION_ENTITY_SAVE = '/continuingEducationCourse/tagClassification/save',
    TAG_CLASSIFICATION_ENTITY_DEL = '/continuingEducationCourse/tagClassification/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const getTagClassificationTreeApi = (params: {}) =>
    defHttp.get < TagClassificationListGetResultModel > (
        {url: Api.GET_TAG_CLASSIFICATION_ENTITY_PAGE_LIST, params},
            {errorMessageMode: 'message'}
    );

export const getTagClassificationListApi = (params: {}) =>
  defHttp.get < TagClassificationListGetResultModel > (
    {url: Api.GET_TAG_CLASSIFICATION_ENTITY_PAGE_LIST, params},
    {errorMessageMode: 'message'}
  );

export const getTagClassificationByIdApi = (id) =>
    defHttp.get < TagClassification > (
        {url: Api.GET_TAG_CLASSIFICATION_ENTITY_BY_ID + id},
            {errorMessageMode: 'message'}
    );

export function tagClassificationUpdateApi(params: TagClassification, mode: ErrorMessageMode = 'modal') {
    return defHttp.put < TagClassification > (
        {
            url: Api.TAG_CLASSIFICATION_ENTITY_UPDATE,
            params,
        },
            {
                errorMessageMode: mode,
            }
    );
}
export const tagClassificationDelByIdApi = (id) =>
    defHttp.delete < TagClassification > (
        {url: Api.TAG_CLASSIFICATION_ENTITY_DEL + id},
            {errorMessageMode: 'message'}
    );


export function tagClassificationSaveApi(params: TagClassification, mode: ErrorMessageMode = 'modal') {
    return defHttp.post < TagClassification > (
        {
            url: Api.TAG_CLASSIFICATION_ENTITY_SAVE,
            params,
        },
            {
                errorMessageMode: mode,
            }
    );
}

